/*
 * @FilePath     : /code-demo/app.js
 * @Description  : 本地 express 服务器
 * @Date         : 2025-04-07 09:07:53
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-07 09:13:38
 */
const express = require('express')

const app = express()
const port = 3000

// 静态模块
const staticArr = ['layui']

// 按 demo 模块，注册“路由” + 静态模块托管
staticArr.forEach(item => {
  app.use('/' + item, express.static(item))
})
app.use(express.static('node_modules'))

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => {
  staticArr.forEach(item => {
    console.log(`http://localhost:${port}/${item}/index.html`)
  })
})
